package com.young.springboot.basic.config;

import lombok.Data;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;


@Data
@ToString
//@Component
// 若@ConfigurationProperties 注解没有和@Component配合使用，则被注解的类不会被加入到spring 容器中
// 此时若想要在容器中使用该bean 则需要在其他会被spring扫描到的并且会被加到spring容器的其他bean上使用
// @EnableConfigurationProperties(Person.class)来开启配置，并将对应的bean 加入到spring 容器中
@ConfigurationProperties("person")
public class Person {
    private String userName;
    private Boolean boss;
    private Date birth;
    private Integer age;
    private Pet pet;
    private String[] interests;
    private List<String> animal;
    private Map<String, Object> score;
    private Set<Double> salarys;
    private Map<String, List<Pet>> allPets;
    private String description;
    private String remark;
}


@Data
@ToString
class Pet{
    private String name;
    private Double weight;
}
